/**
 * Copyright 2010 MiSSO4J author(s)
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.sjsso.util;

import java.io.InputStream;
import java.util.Properties;

public class PropertyUtil {

	private static final String CONFIG_FILE = "app.properties";
	private static final String APPLICATION_ID = "application-id";
	private static final String SSO_SERVER_URL = "sso-server-url";
	private static final String CALLBACK_URL = "callback-url";

	public static Properties props = new Properties();

	static {
		try {
			InputStream is = PropertyUtil.class.getClassLoader()
					.getResourceAsStream(CONFIG_FILE);
			props = new Properties();
			props.load(is);
		} catch (Exception ex) {
			ex.printStackTrace();
		}
	}

	public static String getSSOServerUrl() {
		return props.getProperty(SSO_SERVER_URL);
	}

	public static String getAppId() {
		return props.getProperty(APPLICATION_ID);
	}

	public static String getCallbackUrl() {
		return props.getProperty(CALLBACK_URL);
	}
}
